/**
 *
 */
package com.naiterui.ehp.bp.support.security;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author guoyongxiang
 * @since 1.0.0
 */
public class DoctorLoginInterceptor extends AbstractLoginInterceptor {

    private static final Logger LOGGER = LoggerFactory.getLogger(DoctorLoginInterceptor.class);

    @Override
    protected void printAccessLog(HttpServletRequest request) {

        String origin = request.getHeader(HeaderConstant.HEADER_ORIGIN);
        String inner = request.getHeader(SettingConfig.HEADER_INNER);
        String platform = request.getHeader(HeaderConstant.HEADER_PLATFORM);
        String version = request.getHeader(HeaderConstant.HEADER_VERSION);
        String h5Version = request.getHeader(HeaderConstant.HEADER_NATIVE_VERSION);
        String url = request.getServletPath();

        String doctorId = request.getParameter(SettingConfig.DOCTOR_ID);
        String token = request.getParameter(SettingConfig.TOKEN);

        LOGGER.info("==请求平台来源_p={}, _o={}, 版本号_v={}, _nv={}, inner={}, 请求路径url={}, 请求参数===doctorId={},token={}", platform, origin, version, h5Version,
                inner, url, doctorId, token);
    }

    @Override
    protected final void settingNosignUri(List<String> nosignUri) {
        // swagger
        nosignUri.add("/swagger-ui.html");
        nosignUri.add("/webjars/**");
        nosignUri.add("/swagger-resources/**");
        nosignUri.add("/v2/api-docs");

        // 客户端升级&升级配置JSP
        nosignUri.add("/ad/checkVersion");
        nosignUri.add("/ad/device/verify");
        nosignUri.add("/ad/saveVersion");
        nosignUri.add("/ad/app/h5/upgrade");

        // 登录 & 注册 & 获取短信验证码
        nosignUri.add("/ad/login");
        nosignUri.add("/ad/login/*");
        nosignUri.add("/ad/sendSms");
        nosignUri.add("/ad/time.jsp");

        // 获取首页启动图信息
        nosignUri.add("/ad/index/startInfo");

        // H5分享二维码
        nosignUri.add("/ad/auth/getAppSpreadInfo");

        // B2C使用
        nosignUri.add("/ad/api/recdrug/usage");

        // 客户端基础配置
        nosignUri.add("/ad/doctorInfo/doctorConfig");
        nosignUri.add("/ad/doctorInfo/globalConfig");
        nosignUri.add("/ad/index/noticeDetail");

        // 互联网医院
        nosignUri.add("/ad/doctor/experts");
        nosignUri.add("/ad/doctor/commonDepartment");
        nosignUri.add("/ad/doctor/indexNews");
        nosignUri.add("/ad/doctor/newsList");
        nosignUri.add("/ad/doctor/newsDetails");
        nosignUri.add("/ad/doctor/indexBanner");
        nosignUri.add("/ad/doctor/consult/lately");
        nosignUri.add("/ad/doctor/consult/details");
        nosignUri.add("/ad/doctor/consult/simpleInfo");
        nosignUri.add("/ad/doctor/details/baseInfo");
        nosignUri.add("/ad/doctor/details/services");
        nosignUri.add("/ad/doctor/details/reserve");
        nosignUri.add("/ad/doctor/details/reward");
        nosignUri.add("/ad/doctor/details/saveReport");
        nosignUri.add("/ad/doctor/search/condition");
        nosignUri.add("/ad/doctor/search/list");

        // 客户端活动页JS
        nosignUri.add("/ad/medication/salePrice");

        // 金数据调查问卷回调-用户流失调研
        nosignUri.add("/ad/callback/questionnaire/jinshuju/user");

        // 活动-分享得cdss使用权
        nosignUri.add("/ad/activity/cdss/receive");

        nosignUri.add("/ad/openapi/**");

        //  备案平台回调地址
        nosignUri.add("/ad/jgpt/services/**");

        // 协议
        nosignUri.add("/ad/agreement/**");

    }

}